using UnityEngine.UI;

public class MultipleSkinItem : SkinItem
{
	public int startSkinIndex;

	public int endSkinIndex;

	private int currentIndex;

	public Button nextButton;

	public Button prevButton;

	private void Start()
	{
		for (int i = startSkinIndex; i < endSkinIndex; i++)
		{
			skinIndex = i;
			base.Opened = true;
		}
		if (base.selected)
		{
			SelectItem();
			skinIndex = GameManager.Instance.SelectedSkinIndex;
		}
		else
		{
			DeselectItem();
			skinIndex = startSkinIndex;
		}
		itemImage.sprite = GameManager.Instance.FidgetStore.fidgetTypes[skinIndex].fidgetLevels[0];
		itemName.text = "原始皮肤";
		nextButton.onClick.AddListener(delegate
		{
			skinIndex++;
			if (skinIndex > endSkinIndex)
			{
				skinIndex = startSkinIndex;
			}
			itemImage.sprite = GameManager.Instance.FidgetStore.fidgetTypes[skinIndex].fidgetLevels[0];
			if (base.selected)
			{
				FireItemSelectEvent();
			}
		});
		prevButton.onClick.AddListener(delegate
		{
			skinIndex--;
			if (skinIndex < startSkinIndex)
			{
				skinIndex = endSkinIndex;
			}
			itemImage.sprite = GameManager.Instance.FidgetStore.fidgetTypes[skinIndex].fidgetLevels[0];
			if (base.selected)
			{
				FireItemSelectEvent();
			}
		});
	}
}
